<template>
  <div class="container">
    <input type="text" v-model="userWriteForm.mobile">
    <div class="getSmsCode" @click="getSmsCode">点击发送验证码</div>
    <input type="text" v-model="userWriteForm.code" placeholder="请输入验证码">
    <div class="deleteRedisPersonal" @click="deleteRedisPersonal">清空个人数据</div>
  </div>
</template>

<script>
import request from "@/utils/request";
import wx from "weixin-js-sdk";
import * as config from "./config";
import Cookies from "js-cookie";
import { MessageBox } from "mint-ui";
export default {
  components: {},
  props: {},
  data() {
    return {
      openid: Cookies.get("openid"),
      userWriteForm: {
        mobile: 18321080158,
        code: ""
      }
    };
  },
  watch: {},
  computed: {},
  methods: {
    // 清空个人数据
    deleteRedisPersonal() {
      let that = this;
      return new Promise(function(resolve, reject) {
        request
          .post(
            `${that.global.API_ACT_TOOLS_URL}deleteRedisPersonal?activityId=${
              config.activityId
            }&code=${that.userWriteForm.code}&mobile=${
              that.userWriteForm.mobile
            }&openId=${that.openid}&password=62636364`,
            {
              
            }
          )
          .then(function(data) {
            MessageBox.alert("清理成功！")
          });
      });
    },
    // 获取验证码
    getSmsCode() {
      let that = this;
      return new Promise(function(resolve, reject) {
        request
          .post(
            `${that.global.API_ACT_URL}getSmsCode?activityId=${
              config.activityId
            }&mobile=${that.userWriteForm.mobile}`,
            {}
          )
          .then(function(data) {
            MessageBox.alert("发送成功！")
          });
      });
    }
  },
  mounted() {},
  created() {}
};
</script>
<style lang="css" scoped>
.getSmsCode,
.deleteRedisPersonal {
  width: 3rem;
  height: 1rem;
  line-height: 1rem;
  background-color: aqua;
  text-align: center;
}
input {
  border: 1px solid red;
  font-size: 0.5rem;
}
</style>